package com.pms.dao;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.pms.entity.Employee_project;
import com.pms.util.DBHelp;
import com.pms.util.RowMapper;

public class EmployeeProjectDao {

	private DBHelp<Employee_project> db=new DBHelp<Employee_project>();

	public Employee_project findRoletByEmployeeid(String employeeid,String projectid) {
		String sql="SELECT employeeid,projectid,role FROM t_employee_project WHERE employeeid=? AND projectid=?";
		return db.executeQueryForObject(sql, new Employee_projectRowMapper(),employeeid,projectid);
	}
	
	private class Employee_projectRowMapper implements RowMapper<Employee_project>{

		@Override
		public Employee_project mapperRow(ResultSet rs) throws SQLException {
			Employee_project ep=new Employee_project();
			ep.setEmployeeid(rs.getString("employeeid"));
			ep.setProjectid(rs.getString("projectid"));
			ep.setRole(rs.getString("role"));
			return ep;
		}
		
		
	}
}
